package com.aabte.design2.creational.abstractfactory;

/**
 * 客户端代码仅通过抽象类型（GUIFactory、Button 和 Checkbox）使用工厂
 * 和产品。这让你无需修改任何工厂或产品子类就能将其传递给客户端代码。
 *
 * @author Daniel
 * @version 1.0
 * @date 2020/5/2
 */
public class Application {

    private GUIFactory factory;
    private Button button;
    private Checkbox checkbox;

    public Application(GUIFactory factory) {
        this.factory = factory;
    }

    public void createUI() {
        this.button = factory.createButton();
        this.checkbox = factory.createCheckbox();
    }

    public void paint() {
        button.paint();
        checkbox.paint();
    }

}
